<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
    <meta name="referrer" content="origin">
    <title>日新网 - 课程列表</title>
    <link rel="stylesheet" href="__TMPL__Public/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/style.css">
    <script type="text/javascript" src="__TMPL__Public/assets/js/rem.js"></script>
</head>
<style>
    .carousel-inner .item {
        height: 3rem;

    }
    .carousel-inner .item img {
        width: 100%;
        height: 100%;
    }
    .tab_content h3 {
        font-size: .26rem;
        color: #000232;
        margin: 0 0 .2rem .3rem;
        padding-top: .3rem;
    }
    .questions_btm span:not(:last-child):after {
        content: "、";
    }
    .footer a:nth-child(2) span {
        color: #c8161d;
    }
    .major_content .title h3 {
        background: url("/public/images/img/line_yellow.png") left center no-repeat!important;
        -webkit-background-size: .22rem .24rem!important;
        background-size: .22rem .24rem!important;

    }
</style>
<body>
<!--nav-->
<tc_include file="Public:nav"/>
<!--顶部top-->
<div class="college_list_top">
    <div class="top_content">
        <p class="rightarea ellipsis7">{$subject_info.subject_desc}</p>
        <p class="leftarea ellipsis4">{$subject_info.subject_name}</p>
        <p class="money">￥<span>{$subject_info.subject_price}</span></p>
    </div>
</div>


<!--主要内容-->
<div class="major_content">
    <div class="title clearfix">
        <h3>学院</h3>
    </div>
    <div class="college">
        <volist name="lists" id="vo">
            <div class="college_item" style="cursor: pointer;" data-url="{:U('Lesson/Lesson/lesson_index', ['id' => $vo['id']])}" free="{$vo['free']}">
                <div class="img-ground">
                    <img src="{:sp_get_asset_upload_path($vo['lesson_img'])}" alt="">
                </div>
                <div class="text">
                    <p class="title ellipsis2">{$vo.lesson_name}</p>
                    <div class="text-btm">
                        <img src="{:sp_get_user_avatar_url($vo['avatar'])}" alt="">
                        <span class="name">{$vo.user_nicename}</span>
                    </div>
                </div>
            </div>
        </volist>
    </div>
</div>
<!--页脚-->
<tc_include file="Public:footer"/>

<script type="text/javascript" src="__TMPL__Public/assets/js/jquery.1.12.4.js"></script>
<script src="__TMPL__Public/assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/layer/layer_1.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/wx/jweixin-1.3.2.js"></script>
<script>
    // 快讯展开收起效果
    $(document).ready(function () {
        $('.news_item').click(function () {
            $(this).find('.text2').slideToggle("fast");
        });

        if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
            /*window.location.href="你的手机版地址";*/
            var ua          = navigator.userAgent.toLowerCase();
            var isWeixin    = ua.indexOf('micromessenger') != -1; // 是否微信浏览器
            if (isWeixin) {
                // 在微信浏览器中， 需要静默获取用户信息
                var get_base_info = "{$get_base_info}";
                if (get_base_info) {
                    var redirect_url        = "{:base64_encode(U('Lesson/Lesson/lesson_list', ['subject_id' => $subject_info['id']]))}";
                    window.location.href    = "{:U('Wx/WxLogin/get_wx_user_base_info')}" + "&redirect=" + redirect_url;
                }
            }
        }
    })
</script>
<!--tab页切换效果-->
<script>
    (function () {
        $("#tab_nav ul li").on("click", function () {
            $("#tab_nav ul li").removeClass("active");
            $(this).addClass("active");
        });
    })();
</script>
<script>
    $(function () {
        $(".picture_ground").each(function (index,value) {
            var num = $(value).children().length;
            if(num >=6){
                $(value).find(".last_item").css("display","block");
            }
        });

        $('.college_list_top').css('background', "url({:sp_get_asset_upload_path($subject_info['subject_mobile_img'])}) top left no-repeat");
        $('.college_list_top').css('background-size', '100% 100%');

        var is_login    = "{$is_login}";
        var isMini      = false; // 是否小程序

        $(document).delegate('.college_item', 'click', function () {
            var has_buy     = "{$has_buy}";
            var ua          = navigator.userAgent.toLowerCase();
            var isWeixin    = ua.indexOf('micromessenger') != -1;
            var free        = $(this).attr('free');
            if (has_buy < 0 && free <= 0) {
                wx.miniProgram.getEnv(function(res) {
                    if (res.miniprogram) { //在小程序中
                        isMini = true;
                    }
                });
                if (isMini) {
                    // 在小程序中
                    if (is_login == 0) {
                        layer.msg("请先登录")
                        // 跳转登录页
                        setTimeout(function () {
                            wx.miniProgram.navigateTo({
                                url : '/pages/login/login',
                            })
                        }, 1500);
                    } else {
                        // 跳转至支付页
                        wx.miniProgram.navigateTo({
                            url : '/pages/pay/lesson?subject_id=' + "{$subject_info['id']}&user_id=" + "{$user['id']}",
                        })
                    }
                } else {
                    var url = "{:U('Lesson/Lesson/lesson_buy', ['subject_id' => $subject_info['id']])}";
                    if (isWeixin) {
                        window.location.href = url + "&pay_type=3";
                    } else {
                        $.get(url, {pay_type : 2}, function (re) {
                            if (re.status) {
                                window.location.href = re.pay_url;
                            } else {
                                layer.msg(re.info);
                            }
                        })
                    }
                }
            } else {
                var url = $(this).attr('data-url');
                window.location.href = url;
            }
        });
    })
</script>
<script src="/public/slow_img/checkImg.js"></script>
<script>
    // 图片加载优化
    $(function () {
        checkImgs();
        window.onscroll = throttle(checkImgs);
    });
</script>
</body>
</html>